home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / RELEASE.ZIP / sub_arctic / lib / backdrop_column.java < prev    next >
Encoding:
Java Source  |  1996-10-04  |  4.6 KB  |  140 lines

  1.  
  2. package sub_arctic.lib;
  3.  
  4. import sub_arctic.output.drawable;
  5. import sub_arctic.output.loaded_image;
  6.  
  7. import java.awt.Graphics;
  8.  
  9. /**
  10.  * This is a column (a tiled layout of its children from top to bottom)
  11.  * with a background behind the children. 
  12.  * 
  13.  * @author Scott Hudson
  14.  */
  15. public class backdrop_column extends column {
  16.  
  17.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  18.  
  19.   /** 
  20.    * Background pattern for this column
  21.    */
  22.   protected loaded_image _pattern = null;
  23.  
  24.   /**
  25.    * Background pattern 
  26.    * @return loaded_image the pattern currently in use.
  27.    */
  28.   public loaded_image pattern() {return _pattern;}
  29.  
  30.   /** 
  31.    * Set the Background pattern 
  32.    * @param loaded_image pat the new pattern to use for this column (you 
  33.    *                         can pass null if you don't want a pattern right 
  34.    *                         now).
  35.    */
  36.   public void set_pattern(loaded_image pat) 
  37.     {
  38.       /* set pattern and cause redraw */
  39.       if (_pattern != pat)
  40.     {
  41.           _pattern = pat;
  42.       damage_self();
  43.     }
  44.     }
  45.  
  46.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  47.  
  48.   /** 
  49.    * Full constructor for a backdrop column. We assume you want us to do 
  50.    * sizing automatically with constraints.
  51.    *
  52.    * @param int          xv  x position of the column.
  53.    * @param int          yv  y position of the column.
  54.    * @param int          brd the border around the children of the column (in 
  55.    *                         pixels).
  56.    * @param int          ic  inter-child spacing (in pixels).
  57.    * @param boolean      box whether or not to put a box around this interactor.
  58.    * @param byte         lt  the type of layout to use for this column (must be 
  59.    *                         one of LEFT_JUSTIFIED, RIGHT_JUSTIFIED, OR 
  60.    *                         CENTER_JUSTIFIED).
  61.    * @param loaded_image pat the pattern to use for the background (you can 
  62.    *                         pass null if you don't want a pattern right now).
  63.    */
  64.   public backdrop_column(
  65.     int xv, int yv, 
  66.     int brd, int ic, boolean box,
  67.     byte lt,
  68.     loaded_image pat)
  69.     {
  70.       /* we assume you don't want this be opaque because you are
  71.      presumably supplying a backdrop! */
  72.       super(brd,ic,box,false,lt);
  73.       set_pattern(pat);
  74.     }
  75.  
  76.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  77.  
  78.   /** 
  79.    * Smaller constructor for a backdrop column. This assumes you will 
  80.    * do the positioning of the object with constraints. Again, we will
  81.    * do the sizing via constraints.
  82.    *
  83.    * @param int          brd   the border around the children of the column (in 
  84.    *                           pixels).
  85.    * @param int          ic    inter-child spacing (in pixels).
  86.    * @param boolean      boxed whether or not to put a box around this 
  87.    *                           interactor.
  88.    * @param byte         lt    the type of layout to use for this column (must 
  89.    *                           be one of LEFT_JUSTIFIED, RIGHT_JUSTIFIED, OR 
  90.    *                           CENTER_JUSTIFIED).
  91.    * @param loaded_image pat   the pattern to use for the background (you can 
  92.    *                           pass null if you don't want a pattern right now).
  93.    */
  94.   public backdrop_column(
  95.     int brd, int ic, boolean box,
  96.     byte lt,
  97.     loaded_image pat)
  98.     {
  99.       /* we assume you don't want this be opaque because you are
  100.      presumably supplying a backdrop! */
  101.       super(brd,ic,box,false,lt);
  102.       set_pattern(pat);
  103.     }
  104.  
  105.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  106.  
  107.   /** 
  108.    * Draw the object on the supplied drawable.
  109.    * @param drawable d the drawable to do the drawing on.
  110.    */
  111.   protected void draw_self_local(drawable d) 
  112.     {
  113.       /* draw the backdrop then let the super class do the rest */
  114.       if (pattern() != null)
  115.         d.tileImage(pattern(), 0,0, w()-1, h()-1);
  116.  
  117.       super.draw_self_local(d);
  118.     }
  119.  
  120.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  121.  
  122. }
  123.  
  124. /*=========================== COPYRIGHT NOTICE ===========================
  125.  
  126. This file is part of the subArctic user interface toolkit.
  127.  
  128. Copyright (c) 1996 Scott Hudson and Ian Smith
  129. All rights reserved.
  130.  
  131. The subArctic system is freely available for most uses under the terms
  132. and conditions described in 
  133.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  134. and appearing in full in the lib/interactor.java source file.
  135.  
  136. The current release and additional information about this software can be 
  137. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  138.  
  139. ========================================================================*/
  140.